Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Obsidian live preview required the transition from codemirror 5 to codemirror 6. This meant obsidian had to change their API a bit. In order to get this working with the new API (the main issue was the auto select mode) I had to implement some of the functionality previously provided by code mirror from scratch. Below is a list of the major changes I made.
Changes
Replaced the
WordBoundries
interface in core withEditorRange
from the obsidian packageMoves
isUrl
andisImgEmbed
out ofgetReplaceText
and into stand alone functionsAdded documentation for
getReplaceText
functionAdded documentation for
NothingSelected
enumChanged
somethingSelected()
check at the end ofUrlIntoSelection
toselectedText === ""
becausesomethingSelected()
was returning the wrong value when something was selectedAdded
findWordAt
function to mimic the functionality of the codemirror 5editor.findWordAt
functionChanged some formatting to make the code a bit more readable